
package GerenciadorDeEscolas;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Validadores {

	public boolean validaNome(String nome2) {
		if(nome2 == null || nome2.equals("") || nome2.equals(" ")){
			return false;
		}
		return true;
	}
        
	public boolean validaEmail(String email2) {
		Pattern padrao1 = Pattern.compile("[a-zA-Z[-_.]]+@[a-zA-Z[-_.]]*[a-zA-Z[-_]]");
		Matcher meta1 = padrao1.matcher(email2);
		if(!(meta1.matches())){
			return false;
		}
		return true;
	}


    	public boolean validaCpf(String cpf){
    		Pattern padrao = Pattern.compile("[0-9]{3}.[0-9]{3}.[0-9]{3}-[0-9]{2}");
    		Matcher meta = padrao.matcher(cpf);
    		return meta.matches();
    		
    	}
    	public boolean validaEndereco(String endereco2) throws Exception {
    		if(endereco2 == null || endereco2.equals("") || endereco2.equals(" ")){
    			return false;
    		}
    		return true;
    	}
    	public boolean validaTelefone(String telefone2) {
    		Pattern padrao = Pattern.compile("[(]{1}[0-9]{2}[)]{1}[0-9]{4}-[0-9]{4}");
    		Matcher meta = padrao.matcher(telefone2);
    		return meta.matches();
    	}
}